#include "hdcpform.h"
#include "ui_hdcpform.h"
#include <QKeyEvent>
#include <QSerialPort>
#include <QDebug>
#include "uart.h"
hdcpForm::hdcpForm(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::hdcpForm)
{
    ui->setupUi(this);
    this->setStyleSheet("background-color: rgb(0, 186, 238);");
    box_sel=NULL;
    QImage *img=GetLogo();
    if(img!=NULL)
        ui->label_Logo->setPixmap(QPixmap::fromImage(*img).scaled(ui->label_Logo->size()));

}

hdcpForm::~hdcpForm()
{
    delete ui;
}
void hdcpForm::keyPressEvent(QKeyEvent *event)
{
    int key=event->key();
    qDebug()<< key;
    if(key==Qt::Key_F12||key==Qt::Key_Exit)
    {
        if(ShowPreWin())
            this->hide();
    }
    else
        if(ShowWin(key,0))
            this->hide();
}

void hdcpForm::on_checkBox_clicked()
{
    sendUartCmd(hdcp_setup,HDCP_OFF);
    SelBox(ui->checkBox);
}

void hdcpForm::on_checkBox_3_clicked()
{
    sendUartCmd(hdcp_setup,HDCP_14);
    SelBox(ui->checkBox_3);
}

void hdcpForm::on_checkBox_2_clicked()
{
    sendUartCmd(hdcp_setup,HDCP_22);
    SelBox(ui->checkBox_2);
}

void hdcpForm::on_checkBox_4_clicked()
{
    sendUartCmd(hdcp_setup,HDCP_AUTO);
    SelBox(ui->checkBox_4);
}
